/*
 * KudoGDX is a 2D game development library.
 * It wraps LibGDX, Apache MINA/Codec and a young but efficient GUI implementation.
 */
package com.kudo.gdx.ui.components;

import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.kudo.gdx.Graphics;
import com.kudo.gdx.Image;
import com.kudo.gdx.ui.Component;

/**
 *
 * @author Ike
 */
public class PictureBox extends Component {

    private Image image = null;

    public PictureBox(Image i, float x, float y) {
        super(x, y, i.getWidth(), i.getHeight());
        image = i;
    }

    public PictureBox(Image i, float x, float y, float w, float h) {
        super(x, y, w, h);
        image = new Image(new TextureRegion(i.getTexture(), 0f, 0f, w, h));
    }

    @Override
    public void render(Graphics g) {
        g.draw(image, getBounds().x, getBounds().y);
    }

    public void setImage(Image i) {
        image = i;
    }
}
